import React from 'react';
import { connect } from 'dva';
import { TabBar, Icon,TextareaItem } from 'antd-mobile';
import { routerRedux } from 'dva/router';
import content from '../../common/contentCss/content.css';
import styles from './common.css';
import CustTitle from '../../common/title/title';
import { createForm } from 'rc-form';
import ConsultationView from './pages/consultation/consultation';

function Consultation({loading, dispatch, consultation}) {

  const { jobId } = consultation;

  const ConsultationProps = {
    onSubmit(data){
      data.jobId = jobId;
      dispatch({
        type:'consultation/postAskContent',
        payload:{
          ...data
        }
      })
    },
    goBack(){
      dispatch(routerRedux.goBack());
    }
  }

  return (

    <div style={{backgroundColor:'#fff'}}>
      <ConsultationView {...ConsultationProps}/>
    </div>
  )
}

function mapStateToProps(state, ownProps) {
  return {
    loading: state.loading.global,
    consultation: state.consultation
  }
}
const ConsultationText = createForm()(Consultation);

export default connect(mapStateToProps)(ConsultationText);
